package aapilast2;

import java.util.HashMap;
import java.util.Map;

public class MapDemo {
    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        Integer value = map.put("语文", 90);
        System.out.println(value);
        map.put("数学", 80);
        map.put("英语", 70);
        map.put("物理", 60);
        System.out.println(map);
        value = map.put("物理", 50);//返回被替换的值60
        System.out.println(value);//60
        System.out.println(map);
        value = map.get("物理");
        System.out.println("物理:"+value);
        value = map.get("化学");
        System.out.println("化学:"+value);
        int size = map.size();
        System.out.println(size);

        value = map.remove("物理");
        System.out.println(map);
        System.out.println(value);

        boolean ck = map.containsKey("英语");
        System.out.println("包含key:"+ck);
        boolean cv =map.containsValue(80);
        System.out.println("包含value:"+cv);
    }
}
